<?php

namespace App\Models;

use App\Exceptions\CustomException;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Cashflow extends BaseModel
{
    use HasFactory;
    // 收入
    const TYPE_IN = 10;
    // 支出
    const TYPE_OUT = 20;

    protected $guarded = [];

    public static function boot()
    {
        parent::boot();
    }

    public function category()
    {
        return $this->hasOne(Category::class, 'id', 'category_id');
    }

    public function user()
    {
        return $this->hasOne(Member::class, 'id', 'user_id');
    }
}
